package com.ykt.controller;

import com.ykt.common.utils.UB;
import com.ykt.converter.AdConverter;
import com.ykt.model.Ad;
import com.ykt.service.AdService;
import com.ykt.vo.AdVo;
import com.ykt.vo.ResultVo;

import java.util.List;

/**
 * @author: long.hua
 * @date: 2016-05-27 09:10
 * @since 1.0
 */
public class AdController extends BaseController{


    private AdService adService = enhance(AdService.class.getName(), AdService.class);


    public void find(){
        int userId = UB.i(getPara("userId"));
        int marketId = UB.i(getPara("marketId"));

        List<Ad> ads = adService.findByMarketId(marketId);

        List<AdVo> adVos = AdConverter.convert(ads);

        this.returnJson(ResultVo.success(adVos));
    }

}
